Added compareWith input for select#310
Open
Gimly wants to merge 2 commits into
Open
Conversation
This function allows to add a comparison function for the option used as a value. It is called when searching for the option in the options array. If it is not defined, it defaults to a standard === comparison.
edcarroll
requested changes
Mar 20, 2018
Owner
edcarroll
left a comment
There was a problem hiding this comment.
Thank you for opening this, I'm sorry it's taken so long to be looked at. 2 points and then we're good to go.
| "This must be defined as an arrow function in your class." | ||
| }, | ||
| { | ||
| name: "compareWith", |
Owner
There was a problem hiding this comment.
Could you name this function optionsCompare please to get it inline with optionsLookup?
| public abstract selectOption(option:T):void; | ||
|
|
||
| protected findOption(options:T[], value:U):T | undefined { | ||
| if (this._compareWith) { |
Owner
There was a problem hiding this comment.
I think rather than checking to see if the function has been assigned, it would be cleaner to initialise this property in the constructor with (a, b) => a === b , then you don't need this check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This function allows to add a comparison function for the option used as a value. It is called when searching for the option in the options array. If it is not defined, it defaults to a standard === comparison.
I haven't fully tested yet because I'm not quite sure that this is going in the right direction. If it seems to be correct, I'll update and add maybe an example.
Before submitting a pull request, please make sure you have at least performed the following: